package p.ithorns.integration.transform.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import p.ithorns.integration.transform.entity.Order;
import p.ithorns.integration.transform.entity.User;
import p.ithorns.integration.transform.service.OrderService;
import p.ithorns.integration.transform.service.UserService;

import java.util.Collection;
import java.util.List;
import java.util.Set;

/**
 * OrderController
 *
 * @author ithorns
 * @version 1.0
 * @date 2019/11/11 16:35
 */
@Slf4j
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @Autowired
    private UserService userService;

    @PostMapping("/save")
    public Order save(@RequestBody Order order) {
        return orderService.add(order);
    }

    @PostMapping("/update")
    public void update(@RequestBody Order order) {
        orderService.update(order);
    }

    @GetMapping("/remove/{id}")
    public void remove(@PathVariable("id") long id) {
        orderService.remove(id);
    }

}
